﻿<phone:PhoneApplicationPage 
    x:Class="Portfel.Gielda"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:phoneControls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:telerikPrimitives="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Primitives"
    xmlns:viewModels="clr-namespace:Portfel.ViewModels"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:telerikData="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Data"
    d:DataContext="{d:DesignData SampleData/MainDataViewModelSampleData.xaml}"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="728" d:DesignWidth="480"
    shell:SystemTray.IsVisible="False">
    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:SlideTransition Mode="SlideRightFadeIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:SlideTransition Mode="SlideLeftFadeIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:SlideTransition Mode="SlideRightFadeOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:SlideTransition Mode="SlideLeftFadeOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>
    <UserControl.DataContext>
        <viewModels:MainDataViewModel/>
    </UserControl.DataContext>

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.Resources>
            <Style x:Key="DataBoundListBoxCheckBoxStyle" TargetType="telerikPrimitives:ItemCheckBox">
                <Setter Property="VerticalAlignment" Value="Center"/>
            </Style>
            <DataTemplate x:Key="GroupHeaderTemplate">
                <StackPanel Height="90">
                <Border  Width="300"  Height="50" HorizontalAlignment="Left" VerticalAlignment="Center" Background="{StaticResource PhoneAccentBrush}">
                    <TextBlock FontSize="{StaticResource PhoneFontSizeLarge}"  Text="{Binding}" Foreground="White"  HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" />
                </Border>
                </StackPanel>
            </DataTemplate>
            <DataTemplate x:Key="DataBoundListBoxItemTemplate">
                <Grid Margin="0,0,0,12">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition  Width="Auto"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <StackPanel  Width="95" Height="95" Background="{Binding Color}" >
                        <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{StaticResource PhoneFontSizeMediumLarge}" FontFamily="{StaticResource PhoneFontFamilyNormal}" Text="{Binding Kurs}" Foreground="White" TextWrapping="Wrap"/>
                        <TextBlock Margin="0,0,10,0" HorizontalAlignment="Right" FontSize="{StaticResource PhoneFontSizeSmall}" FontFamily="{StaticResource PhoneFontFamilyNormal}" Text="{Binding Zmiana}" Foreground="White" TextWrapping="NoWrap"/>
                        <TextBlock Margin="0,0,10,0" HorizontalAlignment="Right"  FontSize="{StaticResource PhoneFontSizeSmall}" FontFamily="{StaticResource PhoneFontFamilyNormal}" Text="{Binding ZmianaProcent}" Foreground="White" TextWrapping="NoWrap"/>
                    </StackPanel>

                    <StackPanel Margin="12,-14,0,0"  Grid.Column="1">
                        <TextBlock VerticalAlignment="Stretch" HorizontalAlignment="Left" FontSize="{StaticResource PhoneFontSizeLarge}" FontFamily="{StaticResource PhoneFontFamilySemiLight}" Text="{Binding Title}" TextWrapping="Wrap"/>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100"/>
                                <ColumnDefinition Width="78*"/>
                                <ColumnDefinition Width="13*" />
                                <ColumnDefinition Width="66*"/>
                                <ColumnDefinition Width="78*"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>

                            </Grid.RowDefinitions>
                            <TextBlock  FontSize="{StaticResource PhoneFontSizeSmall}" Text="wolumen : " TextAlignment="Right" Grid.Column="0" Grid.Row="0"/>
                            <TextBlock FontSize="{StaticResource PhoneFontSizeSmall}"  Text="{Binding Wolumen}" Grid.Column="1" Grid.Row="0" />
                            <TextBlock FontSize="{StaticResource PhoneFontSizeSmall}"  Text="min : " TextAlignment="Right" Grid.Column="2" Grid.Row="0" Grid.ColumnSpan="2" />
                            <TextBlock FontSize="{StaticResource PhoneFontSizeSmall}"  Text="{Binding Min}" Grid.Column="4" Grid.Row="0" />
                            <TextBlock FontSize="{StaticResource PhoneFontSizeSmall}"  Text="obroty :" TextAlignment="Right" Grid.Column="0" Grid.Row="1" />
                            <TextBlock FontSize="{StaticResource PhoneFontSizeSmall}"  Text="{Binding Obroty}" Grid.Column="1" Grid.Row="1" />
                            <TextBlock FontSize="{StaticResource PhoneFontSizeSmall}"  Text="max : " TextAlignment="Right" Grid.Column="2" Grid.Row="1" Grid.ColumnSpan="2" />
                            <TextBlock FontSize="{StaticResource PhoneFontSizeSmall}"  Text="{Binding Max}" Grid.Column="4" Grid.Row="1" />

                        </Grid>

                        <!--<TextBlock  FontSize="{StaticResource PhoneFontSizeNormal}" Text="{Binding Information}" TextWrapping="Wrap"/>
                        <TextBlock  FontSize="{StaticResource PhoneFontSizeNormal}" Text="{Binding Information}" TextWrapping="Wrap"/>-->
                    </StackPanel>

                </Grid>
            </DataTemplate>

            <DataTemplate x:Key="ObligacjaTemplate">
                <Grid Margin="0,0,0,12">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition  Width="Auto"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <StackPanel  Width="95" Height="95" Background="{Binding Color}" >
                        <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{StaticResource PhoneFontSizeMediumLarge}" FontFamily="{StaticResource PhoneFontFamilyNormal}" Text="{Binding Kurs}" Foreground="White" TextWrapping="Wrap"/>
                        <TextBlock Margin="0,0,10,0" HorizontalAlignment="Right" FontSize="{StaticResource PhoneFontSizeSmall}" FontFamily="{StaticResource PhoneFontFamilyNormal}" Text="{Binding Zmiana}" Foreground="White" TextWrapping="NoWrap"/>
                        <TextBlock Margin="0,0,10,0" HorizontalAlignment="Right"  FontSize="{StaticResource PhoneFontSizeSmall}" FontFamily="{StaticResource PhoneFontFamilyNormal}" Text="{Binding ZmianaProcent}" Foreground="White" TextWrapping="NoWrap"/>
                    </StackPanel>

                    <StackPanel Margin="12,-14,0,0"  Grid.Column="1">
                        <TextBlock VerticalAlignment="Stretch" HorizontalAlignment="Left" FontSize="{StaticResource PhoneFontSizeLarge}" FontFamily="{StaticResource PhoneFontFamilySemiLight}" Text="{Binding Title}" TextWrapping="Wrap"/>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="80"/>
                                <ColumnDefinition Width="110"/>
                                <ColumnDefinition Width="13*" />
                                <ColumnDefinition Width="66*"/>
                                <ColumnDefinition Width="78*"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>

                            </Grid.RowDefinitions>
                            <TextBlock  FontSize="{StaticResource PhoneFontSizeSmall}" Text="data : " TextAlignment="Right" Grid.Column="0" Grid.Row="0"/>
                            <TextBlock FontSize="{StaticResource PhoneFontSizeSmall}"  Text="{Binding Termin}" Grid.Column="1" Grid.Row="0" />
                            <TextBlock FontSize="{StaticResource PhoneFontSizeSmall}"  Text="min : " TextAlignment="Right" Grid.Column="2" Grid.Row="0" Grid.ColumnSpan="2" />
                            <TextBlock FontSize="{StaticResource PhoneFontSizeSmall}"  Text="{Binding Min}" Grid.Column="4" Grid.Row="0" />
                            <!--<TextBlock FontSize="{StaticResource PhoneFontSizeSmall}"  Text="obroty :" TextAlignment="Right" Grid.Column="0" Grid.Row="1" />
                            <TextBlock FontSize="{StaticResource PhoneFontSizeSmall}"  Text="{Binding Obroty}" Grid.Column="1" Grid.Row="1" />-->
                            <TextBlock FontSize="{StaticResource PhoneFontSizeSmall}"  Text="max : " TextAlignment="Right" Grid.Column="2" Grid.Row="1" Grid.ColumnSpan="2" />
                            <TextBlock FontSize="{StaticResource PhoneFontSizeSmall}"  Text="{Binding Max}" Grid.Column="4" Grid.Row="1" />

                        </Grid>

                        <!--<TextBlock  FontSize="{StaticResource PhoneFontSizeNormal}" Text="{Binding Information}" TextWrapping="Wrap"/>
                        <TextBlock  FontSize="{StaticResource PhoneFontSizeNormal}" Text="{Binding Information}" TextWrapping="Wrap"/>-->
                    </StackPanel>

                </Grid>
            </DataTemplate>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <TextBlock x:Name="ApplicationTitle" Margin="24,17,0,0" Text="portfel" Style="{StaticResource PhoneTextNormalStyle}"/>

        <Grid Grid.Row="1">
            <phoneControls:Pivot x:Name="MainPivot" Margin="0,-12,0,0">
                <phoneControls:PivotItem Header="akcje">
                    <telerikData:RadJumpList x:Name="AkcjeList"
                          GroupDescriptorsSource="{Binding GroupDescriptorsA}"
                               GroupPickerItemsSource="{Binding GroupPickerA}"
                                             GroupPickerItemTap="GroupPickerItemTap"
                                             GroupHeaderTemplate="{StaticResource GroupHeaderTemplate}"
                                                        Margin="-12,6,12,0"
                                                        ItemsSource="{Binding ItemsA}" 
                                                        IsCheckModeEnabled="True"
                                                        IsCheckModeActiveChanged="RadDataBoundListBox_IsCheckModeActiveChanged"
                                                        CheckBoxStyle="{StaticResource DataBoundListBoxCheckBoxStyle}"
                                                        ItemTemplate="{StaticResource DataBoundListBoxItemTemplate}">
                        <telerikData:RadJumpList.GroupPickerItemsPanel>
                            <ItemsPanelTemplate>
                                <telerikPrimitives:RadWrapPanel Margin="12,12,12,12" ItemWidth="104" ItemHeight="104" />
                            </ItemsPanelTemplate>
                        </telerikData:RadJumpList.GroupPickerItemsPanel>
                    </telerikData:RadJumpList>

                </phoneControls:PivotItem>
                <phoneControls:PivotItem Header="obligacje">
                    <telerikData:RadJumpList x:Name="ObligacjeList"
                          GroupDescriptorsSource="{Binding GroupDescriptorsO}"
                               GroupPickerItemsSource="{Binding GroupPickerO}"
                                             GroupPickerItemTap="GroupPickerItemTap"
                                             GroupHeaderTemplate="{StaticResource GroupHeaderTemplate}"
                                                        Margin="-12,6,12,0"
                                                        ItemsSource="{Binding ItemsO}" 
                                                        IsCheckModeEnabled="True"
                                                        IsCheckModeActiveChanged="RadDataBoundListBox_IsCheckModeActiveChanged"
                                                        CheckBoxStyle="{StaticResource DataBoundListBoxCheckBoxStyle}"
                                                        ItemTemplate="{StaticResource ObligacjaTemplate}">
                        <telerikData:RadJumpList.GroupPickerItemsPanel>
                            <ItemsPanelTemplate>
                                <telerikPrimitives:RadWrapPanel Margin="12,12,12,12" ItemWidth="104" ItemHeight="104" />
                            </ItemsPanelTemplate>
                        </telerikData:RadJumpList.GroupPickerItemsPanel>
                    </telerikData:RadJumpList>
                </phoneControls:PivotItem>
            </phoneControls:Pivot>
        </Grid>
    </Grid>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/Select.png" Click="ApplicationBarIconButton_Click" Text="wybierz"/>
            <shell:ApplicationBarIconButton IconUri="/Images/Buy.png" Text="kup" Click="ApplicationBarIconBuy_OnClick"/>
            <shell:ApplicationBarIconButton IconUri="/Images/Refresh.png" Click="ApplicationBarIconRefresh_OnClick" Text="odśwież"/>
            <!--<shell:ApplicationBarIconButton IconUri="/Images/appbar_button4.png" Text="Button 4"/>-->
            <!--<shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>-->
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>
